import { handleActions } from "redux-actions";
import { filter_product_success } from '../actions/filter'

const initalState = {
	size: 0,
	data: []
}

const filterReducer = handleActions({
	[filter_product_success]: (state, action) => ({
		size: action.payload.size,
		data: action.payload.skip === 0 ?
		action.payload.data: [...state.data, ...action.payload.data]
	})
},initalState)

export default filterReducer